﻿<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/style.css"/>
	</head>
	<body>
		<%- include("./include/top.ejs") %>
		<main>
			<div class="banner"><img src="images/1.jpg"><span>勇攀高峰 砥砺前行</span></div>

			<div class="container">
				<aside>
					<h2>产品服务</h2>
					<ul>
						<li class="<%= (cat_id==1)?'cur':'' %>"><a href="/product?cat_id=1">汽车配件</a></li>
						<li class="<%= (cat_id==2)?'cur':'' %>"><a href="/product?cat_id=2">轮船配件</a></li>
						<li class="<%= (cat_id==3)?'cur':'' %>"><a href="/product?cat_id=3">数码产品</a></li>
						<li class="<%= (cat_id==4)?'cur':'' %>"><a href="/product?cat_id=4">家居用品</a></li>
					</ul>
				</aside>
				<article class="main">					
				<h2>商品列表</h2>
				<DIV id=productList>
					<% for(var i=0;i<products.length;i++){%>
				    <DL class=noMargin>
						<DT><A href="/detail/<%= products[i].id %>">
								<!-- 不考虑后台上传图片的显示，用下面一行代码 -->
								<!-- <IMG alt=<%= products[i].name %>  src="/<%= products[i].image %>"> -->  

								<!-- 若管理后台（http://localhost:3006/）上传了图片，存到表中是upload开头，要用网络地址显示新上传图片的路径 -->
<IMG src="<%= (products[i].image.substr(0,6)=='upload')?('http://localhost:3006/'+products[i].image):('/'+products[i].image) %>">
							
							
							
							
							</A></DT>
						<DD>
							<P class=name><A href="/detail/<%= products[i].id %>"><%= products[i].name %></A></P>
							<P class=price>价格：￥<%= products[i].price %> 元</P>
							<P class=brief><%- products[i].content.substr(0,30) %>...</P>
							
						</DD>
					</DL>
					<%}%>
					<DIV class=clear></DIV>
				</DIV>
		</main>
		<%- include("./include/bottom.ejs") %>
	</body>
</html>